import os

import numpy as np
from keras.models import load_model
from keras.preprocessing import image
FilePath="Images/predict_images"
model = load_model('TrainedModel/resnet18.h5')
images_path_list=os.listdir(FilePath)
for path in images_path_list:
    img = image.load_img(FilePath+"/"+path, target_size=(128, 128))
    x = image.img_to_array(img)
    x = np.expand_dims(x, axis=0)
    result = np.vstack([x])
    predict = model.predict(result)
    if predict[0] > 0.5:
        print("%s  is a dog"%(path))
    else:
        print("%s is a cat"%(path))









